home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 251_01 / advsys.doc < prev    next >
Text File  |  1987-10-27  |  31KB  |  1,189 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.                       ADVSYS - An Adventure Writing System
  8.  
  9.                                   Version 1.2
  10.  
  11.                                  by David Betz
  12.                               114 Davenport Avenue
  13.                               Manchester, NH 03103
  14.                              (603) 625-4691 (home)
  15.  
  16.                                  July 14, 1986
  17.  
  18.                        Copyright (c) 1986, by David Betz
  19.                               All Rights Reserved
  20.         Permission is hereby granted for unrestricted non-commercial use
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.         ADVSYS            An Adventure Writing System             Page 2
  71.  
  72.  
  73.         INTRODUCTION
  74.  
  75.         ADVSYS is a special purpose programming language that was
  76.         specifically designed to be used to write computer text
  77.         adventure games.  It includes a facility for defining the kinds
  78.         of objects that are common in adventures.  Some objects
  79.         represent locations on the game map, some objects represent
  80.         things that the player can find while exploring the adventure
  81.         world, and some objects represent other characters that the
  82.         adventurer can encounter during his or her journeys.  The
  83.         adventure language also provides a facility to define actions.
  84.         Actions are short sections of code that determine what happens
  85.         in response to a command from the player.  These two concepts,
  86.         "objects" and "actions" form the basis for the adventure
  87.         language.
  88.  
  89.  
  90.         ACKNOWLEDGEMENTS
  91.  
  92.         Although I have written all of the code associated with this
  93.         adventure writing system, I must acknowledge the assistance of
  94.         one individual without whom this project would probably never
  95.         have reached completion.  That person is Gary McGath.  Gary was
  96.         interested in writing a commercial quality adventure game and I
  97.         convinced him to write it using my system (which was as yet
  98.         almost completely unspecified) instead of using a traditional
  99.         programming language.  The input that Gary provided during the
  100.         development of his game contributed significantly to the overall
  101.         design of the system.  I would like to thank Gary for that
  102.         contribution.
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.         ADVSYS            An Adventure Writing System             Page 3
  137.  
  138.  
  139.         USING THE SYSTEM TO WRITE AN ADVENTURE
  140.  
  141.         In order to write an adventure using this system, you need to
  142.         write an adventure description.  This is an ordinary ASCII text
  143.         file containing definitions for all of the objects and actions
  144.         in your adventure game.  This file is used as input to the
  145.         adventure compiler.  The compiler takes the adventure
  146.         description and compiles it into a set of data structures.
  147.  
  148.         In order to play an adventure written using this system, you
  149.         need the data structure file that was produced by the compiler
  150.         and the adventure interpreter program.  The interpreter uses the
  151.         information produced by the adventure compiler to allow a player
  152.         to play the adventure game.  Notice that it is not necessary for
  153.         the player to have access to the original adventure description
  154.         file.  All of the information that is necessary to play the
  155.         adventure game is contained within the data structure file that
  156.         is produced by the compiler.  This file is a binary file that
  157.         cannot be simply "listed" to reveal the internal workings of the
  158.         adventure.
  159.  
  160.         The adventure compiler is called ADVCOM and the interpreter is
  161.         called ADVINT.  These two programs in conjunction with this
  162.         documentation are all that is required to write and play
  163.         adventure games using this system.
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.         ADVSYS            An Adventure Writing System             Page 4
  203.  
  204.  
  205.         RUNNING THE COMPILER
  206.  
  207.         If you have created an adventure definition file called
  208.         "MYADV.ADV", you can compile it with the command:
  209.  
  210.                 A>advcom myadv
  211.  
  212.         Typing this command will invoke the adventure compiler and cause
  213.         it to compile the file named "MYADV.ADV".  The ".ADV" extension
  214.         is added to the file name by the compiler.  During the process
  215.         of compiling the file, many messages will be printed telling
  216.         about the progress of the compiler.  At the end of the
  217.         compilation process, the compiler prints a set of statistics
  218.         describing the resulting data structure file.  This file will be
  219.         called "MYADV.DAT".  It contains the data structures needed by
  220.         the adventure interpreter to allow a player to play the
  221.         adventure game.
  222.  
  223.         Note: The "A>" in the line above is the MS-DOS prompt and should
  224.         not be typed as part of the command.
  225.  
  226.  
  227.         RUNNING THE INTERPRETER
  228.  
  229.         Assuming that you have a compiled adventure data file called
  230.         "MYADV.DAT", you can play the adventure by typing the command:
  231.  
  232.                 A>advint myadv
  233.  
  234.         This command will start the adventure.  There will probably be
  235.         some text printed at this point describing the adventure and the
  236.         initial situation.  You will then be prompted to type a command.
  237.         The prompt is the colon character.  The format for commands is
  238.         described under the section about the parser.  After typing a
  239.         command, you will be told what happened as a result of your
  240.         command, your new situation will be described and you will begin
  241.         the loop again.
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.         ADVSYS            An Adventure Writing System             Page 5
  269.  
  270.  
  271.         ADVENTURE DESCRIPTION FILE FORMAT
  272.  
  273.             All adventure description files contain a collection of
  274.             statements.  These statements must be formed according to
  275.             the following rules:
  276.  
  277.  
  278.         The adventure definition statement:
  279.  
  280.             All adventure definitions should have an ADVENTURE
  281.             statement.  This statement gives the name of the adventure
  282.             and the version number of the definition file.  Each
  283.             adventure should have a unique name.  This name is used to
  284.             identify "saved position" files and insure that only files
  285.             that correspond to the current adventure are restored.  The
  286.             version number allows the author to have many versions of
  287.             the same adventure during development and guarantee that
  288.             "save" files from one version aren't restored into another
  289.             version.
  290.  
  291.               (ADVENTURE name version)
  292.  
  293.           Example:
  294.  
  295.               (ADVENTURE sample 1)
  296.  
  297.  
  298.         Vocabulary statements:
  299.  
  300.             These statements add words to the adventure vocabulary.
  301.  
  302.               (ADJECTIVE word*)
  303.               (PREPOSITION word*)
  304.               (CONJUNCTION word*)
  305.               (ARTICLE word*)
  306.               (SYNONYM word synonym*)
  307.  
  308.           Examples:
  309.  
  310.               (ADJECTIVE red blue)
  311.               (CONJUNCTION and)
  312.               (SYNONYM big large)
  313.  
  314.           Note:
  315.  
  316.               Words are also added to the vocabulary by the object
  317.               and action definitions using the NOUN, ADJECTIVE, VERB
  318.               and PREPOSITION statements.
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.         ADVSYS            An Adventure Writing System             Page 6
  335.  
  336.  
  337.         Constant definition statement:
  338.  
  339.               (DEFINE name value)
  340.  
  341.           Examples:
  342.  
  343.               (DEFINE what "I don't understand what you're saying!\n")
  344.               (DEFINE max-load 100)
  345.  
  346.  
  347.         Function definition statement:
  348.  
  349.               (DEFINE (function-name [arg-name]* [&aux tmp-name*]) expr*)
  350.  
  351.           Example:
  352.  
  353.               (DEFINE (factorial n)
  354.                 (IF (< n 2)
  355.                   1
  356.